package com.ktgj.customer.service.impl;

import java.util.List;
import com.ktgj.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktgj.customer.mapper.CustomeraccountMapper;
import com.ktgj.customer.domain.Customeraccount;
import com.ktgj.customer.service.ICustomeraccountService;

/**
 * 会员账号Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-01-04
 */
@Service
public class CustomeraccountServiceImpl implements ICustomeraccountService 
{
    @Autowired
    private CustomeraccountMapper customeraccountMapper;

    /**
     * 查询会员账号
     * 
     * @param id 会员账号ID
     * @return 会员账号
     */
    @Override
    public Customeraccount selectCustomeraccountById(Long id)
    {
        return customeraccountMapper.selectCustomeraccountById(id);
    }

    /**
     * 查询会员账号列表
     * 
     * @param customeraccount 会员账号
     * @return 会员账号
     */
    @Override
    public List<Customeraccount> selectCustomeraccountList(Customeraccount customeraccount)
    {
        return customeraccountMapper.selectCustomeraccountList(customeraccount);
    }

    /**
     * 新增会员账号
     * 
     * @param customeraccount 会员账号
     * @return 结果
     */
    @Override
    public int insertCustomeraccount(Customeraccount customeraccount)
    {
        customeraccount.setCreateTime(DateUtils.getNowDate());
        return customeraccountMapper.insertCustomeraccount(customeraccount);
    }

    /**
     * 修改会员账号
     * 
     * @param customeraccount 会员账号
     * @return 结果
     */
    @Override
    public int updateCustomeraccount(Customeraccount customeraccount)
    {
        return customeraccountMapper.updateCustomeraccount(customeraccount);
    }

    @Override
    public int updateCustomeraccountByCustomerId(Customeraccount customeraccount) {
        return customeraccountMapper.updateCustomeraccountByCustomerId(customeraccount);
    }

    /**
     * 批量删除会员账号
     * 
     * @param ids 需要删除的会员账号ID
     * @return 结果
     */
    @Override
    public int deleteCustomeraccountByIds(Long[] ids)
    {
        return customeraccountMapper.deleteCustomeraccountByIds(ids);
    }

    /**
     * 删除会员账号信息
     * 
     * @param id 会员账号ID
     * @return 结果
     */
    @Override
    public int deleteCustomeraccountById(Long id)
    {
        return customeraccountMapper.deleteCustomeraccountById(id);
    }

    /**
     * 查询12306账号密码（远程调用）
     * @param customerId
     * @param accountType
     * @return
     */
    @Override
    public Customeraccount queryAccountIdAndAccountPassword(Long customerId, String accountType) {
        return customeraccountMapper.queryAccountIdAndAccountPassword(customerId, accountType);
    }
}
